package coreservlets.server;

import org.hibernate.Session;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import coreservlets.HibernateUtil;
import coreservlets.client.*;
public class DataServiceImpl extends RemoteServiceServlet implements DataService {

  private static final long serialVersionUID = 4860099427026709561L;

@Override
  public String getButton1Data() {
	
	  ApplicationContext con = new ClassPathXmlApplicationContext("spring.xml");
      Session ss = HibernateUtil.getSessionFactory().openSession();
	  ss.beginTransaction();
	  Message mas = (Message) con.getBean("message");
	  mas = (Message) ss.get(Message.class, 1);
      String result =mas.getMessage();
      return (result);
  }
  
}
